From 0882a91d626f20d0e83e7ec19abc26afb03926b6 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Mon, 18 Feb 2013 05:38:40 +0000 Subject: [PATCH] Don't double UTF-8 encode in gbfputs(QString, gbfile). git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4310 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/gbfile.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gpsbabel/gbfile.cc b/gpsbabel/gbfile.cc index d0abd48cd..1a6e86a43 100644 --- a/gpsbabel/gbfile.cc +++ b/gpsbabel/gbfile.cc @@ -780,7 +780,10 @@ gbfputs(const char* s, gbfile* file) int gbfputs(const QString& s, gbfile* file) { - const char* qs = xstrdup(s.toUtf8().data()); + // Why is this Latin1() and not toUtf8()? Becuase our string data is + // already utf8 in most of the "C" places and calling toUtf8() here would + // double encode them. + const char* qs = xstrdup(s.toLatin1().data()); unsigned int l = strlen(qs); int rv = gbfwrite(qs, 1, l, file); xfree(qs); @@ -794,7 +797,7 @@ gbfputs(const QString& s, gbfile* file) int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file) { - int result; + unsigned int result; result = file->filewrite(buf, size, members, file); if (result != members) { -- 2.30.2